package com.tensai.study.java.newconcept.typereactiveprogram.reactor.mono;

import lombok.extern.slf4j.Slf4j;
import org.junit.Test;
import reactor.core.publisher.Mono;

/**
 * @author Tensai
 */
@Slf4j
public class ZipTest {

	@Test
	public void test() {
		Mono<Double> firstMono = Mono.just(50.0);
		Mono<Double> lastMono = Mono.just(100.0);
		Mono<Double> totalMono = Mono.zip(firstMono, lastMono).map(it -> it.getT2() - it.getT1());
		Mono.zip(firstMono, lastMono, totalMono)
				.subscribe(it -> log.info(String.valueOf(it)));
	}
}
